package pl.rzarajczyk.breaktime;

import java.awt.event.MouseEvent;
import java.io.IOException;
import org.apache.commons.logging.LogFactory;
import pl.rzarajczyk.breaktime.utils.Scheduler;

/**
 *
 * @author Rafal
 */
public enum MenuAction {
   
    PAUSE() {
        @Override
        public void action(MouseEvent e, Menu menu) {
            Scheduler scheduler = menu.getScheduler();
            scheduler.setPaused( ! scheduler.isPaused() );
        }
        
    },
    SHOW_TIMER() {
        @Override
        public void action(MouseEvent e, Menu menu) {
            menu.getTimerWindow().setScreenCorner( menu.getScreenCorner() );
            menu.getTimerWindow().setVisible( ! menu.getTimerWindow().isVisible() );
        }
    },
    SHOW_SETTINGS() {
        @Override
        public void action(MouseEvent e, Menu menu) {
            menu.getSettingsWindow().setVisible(true);
        }
    },
    ABOUT() {
        @Override
        public void action(MouseEvent e, Menu menu) {
            menu.getAboutWindow().setVisible(true);
        }
    },
    EXIT() {
        @Override
        public void action(MouseEvent e, Menu menu) {
            try {
                menu.shutdown();
            } catch (IOException ex) {
                LogFactory.getLog(this.getClass()).error(ex);
            }
            System.exit(0);
        }
    }
    ;

    public abstract void action(MouseEvent e, Menu menu);
}
